package com.zyd.shiro.persistence.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.zyd.shiro.persistence.beans.UserExamine;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface MallUserExamineDao extends JpaRepository<UserExamine,Integer>,JpaSpecificationExecutor<UserExamine>{

	@Query(value = "select * from mall_user_examine bean where bean.state = ?1", nativeQuery = true)
	List<UserExamine> findAllByState(Integer state);

	@Query(value = "select * from mall_user_examine ts where ts.user_id=?1", nativeQuery = true)
	List<UserExamine> findAllByUser_id(Integer user_id);

	@Query(value = "update mall_user_examine ue set ue.state=?1 AND ue.reasion=?2 where ts.id=?3 ", nativeQuery = true)
	void updateState(Integer state,String reasion,Integer id);

}
